/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.laboratory;

import ejb.system.AbstractFacade;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author ciummo
 */
@Stateless
public class ValidazioneFacade extends AbstractFacade<Validazione> implements ValidazioneFacadeRemote {
    @PersistenceContext(unitName = "DGestEJBSeverPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ValidazioneFacade() {
        super(Validazione.class);
    }
    
    public List<Validazione> findValidazioniFromSerialeProdotto (String serialProdotto){

        String sql = "SELECT v FROM Validazione v WHERE v.serialProdotto = :serialProdotto";
        Query query = em.createQuery(sql);
        query.setParameter("serialProdotto", serialProdotto);
        return query.getResultList();
    }
}
